home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 26 / AMIGAplus Sonderheft 26 (2000)(Falke)(DE)(Track 1 of 2)[!].iso / Tools / GFX-Viewer / Animviewer / mpegvideo_datatype / mpegamiga.h < prev    next >
C/C++ Source or Header  |  1999-03-29  |  10KB  |  267 lines

  1.  
  2. #ifndef MPEGAMIGA_H
  3. #define MPEGAMIGA_H 1
  4.  
  5. /*
  6. **
  7. **  $VER: mpegamiga.h 1.11 (2.11.97)
  8. **  mpegvideo.datatype 1.11
  9. **
  10. **  amiga includes
  11. **
  12. **  Written 1996/1997 by Roland 'Gizzy' Mainz
  13. **
  14. */
  15.  
  16. /* Create bool retval from any type of data */
  17. #define MAKEBOOL( x ) ((BOOL)((x) != NULL))
  18.  
  19.  
  20. struct ProgressRequester
  21. {
  22.     struct Window *pr_Window;
  23.     ULONG          pr_Curr;
  24.     ULONG          pr_Max;  /* ~0UL means: gauge disabled */
  25.     ULONG          pr_StartSecond;
  26. };
  27.  
  28. struct FrameNode
  29. {
  30.     struct MinNode      fn_Node;
  31.  
  32. /* Misc */
  33.     WORD                fn_UseCount;
  34.     BOOL                fn_IsKeyFrame; /* This frame must not be freed by ADTM_UNLOADFRAME */
  35.     struct FrameNode   *fn_IFrame;     /* links back to the last I-Frame  */
  36.     ULONG               fn_Reserved0;
  37.     ULONG               fn_Reserved1;
  38.     ULONG               fn_Reserved2;
  39.  
  40. /* Timing section */
  41.     ULONG               fn_TimeStamp;
  42.     ULONG               fn_Frame;
  43.     ULONG               fn_Duration;
  44.  
  45. /* BitMap loading section */
  46.     LONG                fn_BMOffset; /* File offset (0 is begin of file) of last I frame */
  47.     ULONG               fn_BMSize;   /* Chunk size  */
  48.  
  49. /* Bitmap section */
  50.     struct BitMap      *fn_BitMap;
  51.     struct ColorMap    *fn_CMap;
  52.  
  53. /* Sample section */
  54.     BYTE               *fn_Sample;
  55.     ULONG               fn_SampleLength;
  56.     ULONG               fn_Period;
  57. };
  58.  
  59.  
  60. /* mvid.datatype class instance data */
  61. struct MPEGVideoInstData
  62. {
  63.     struct ClassBase        *mvid_ClassBase;      /* Links back to class library base */
  64.  
  65.     struct SignalSemaphore   mvid_SigSem;         /* Instance data lock                      */
  66.     UWORD                    mvid_Pad0;
  67.  
  68.     APTR                     mvid_Pool;           /* Pool for misc frames  */
  69.     BPTR                     mvid_VerboseOutput;  /* verbose log file */
  70.     struct BitMap           *mvid_KeyBitMap;      /* key bitmap */
  71.     struct MinList           mvid_FrameList;      /* frame nodes itself (list of struct FrameNodes) */
  72.     struct FrameNode        *mvid_FirstFrameNode;
  73.     ULONG                    mvid_TicksPerFrame;
  74.     LONG                     mvid_retval;
  75.     LONG                     mvid_retval2;
  76.     ULONG                    mvid_ModeID;
  77.     ULONG                    mvid_MaxFrame;
  78.     ULONG                    mvid_SkipFrames;
  79.     BOOL                     mvid_IgnoreErrors;
  80.     BOOL                     mvid_LoadAll;
  81.     BYTE                    *mvid_Sample;
  82.     ULONG                    mvid_SampleLength;
  83.     ULONG                    mvid_Period;
  84.     ULONG                    mvid_Volume;
  85.     ULONG                    mvid_MinTotalMem;
  86.  
  87.     /* Used by SearchColor (mpegamiga.c) */
  88.     LONG                     mvid_ColorError;
  89.     BOOL                     mvid_PalettePerFrame;
  90.     BOOL                     mvid_Quality;  /* use floating-point DCT */
  91.  
  92.     /* input buffer */
  93.     ULONG                    mvid_BufLength;
  94.  
  95.     /* used by mpegordered.c (static) */
  96.     /* Structures used to implement hybrid ordered dither/floyd-steinberg dither algorithm. */
  97. #define DITH_SIZE (16)
  98.     ULONG                   *mvid_l_darrays[ DITH_SIZE ];
  99.     ULONG                   *mvid_cr_darrays[ DITH_SIZE ];
  100.     ULONG                   *mvid_cb_darrays[ DITH_SIZE ];
  101. #define l_darrays  (mvid -> mvid_l_darrays)
  102. #define cr_darrays (mvid -> mvid_cr_darrays)
  103. #define cb_darrays (mvid -> mvid_cb_darrays)
  104.  
  105.     /* globals */
  106.     /* used by bit i/o */
  107.     ULONG                    mpegv_curBits;
  108.     LONG                     mpegv_bitOffset;
  109.     LONG                     mpegv_bufLength;
  110.     ULONG                   *mpegv_bitBuffer;
  111. /* External declarations of bitstream global variables. */
  112. #define curBits   (mvid -> mpegv_curBits)
  113. #define bitOffset (mvid -> mpegv_bitOffset)
  114. #define bufLength (mvid -> mpegv_bufLength)
  115. #define bitBuffer (mvid -> mpegv_bitBuffer)
  116.  
  117.     /* used to track the file position of the last read */
  118.     LONG                     mvid_ReadMarkPos; /* file position of last Read() */
  119.     UBYTE                   *mvid_ReadMark;    /* buffer pos of last read */
  120.  
  121.     LONG                     mvid_Last_PIC_SC_Pos; /* Last position of PICTURE_START_CODE or GOP_START_CODE */
  122.     LONG                     mvid_Last_I_TYPE_Pos; /* begin of last I_TYPE frame */
  123.  
  124.     struct FrameNode        *mvid_LastIFrameNode;
  125.     VidStream               *mvid_VidStream;
  126.     BOOL                     mvid_IndexScan;
  127.     BOOL                     mvid_DoDebug2; /* obsolete */
  128.     BOOL                     mvid_DoDebug;
  129.     BOOL                     mvid_DoSyntax;
  130.  
  131.     double                   mvid_gammaCorrect;  /* Defaults to 1.0 */
  132.     double                   mvid_chromaCorrect; /* Defaults to 1.0 */
  133.  
  134. #define gammaCorrect  (mvid -> mvid_gammaCorrect)
  135. #define chromaCorrect (mvid -> mvid_chromaCorrect)
  136.  
  137.     /* used in mpeg16bit.c (static) */
  138.     long                    *L_tab,
  139.                             *Cr_r_tab,
  140.                             *Cr_g_tab,
  141.                             *Cb_g_tab,
  142.                             *Cb_b_tab;
  143.  
  144. #define L_tab    (mvid -> L_tab)
  145. #define Cr_r_tab (mvid -> Cr_r_tab)
  146. #define Cr_g_tab (mvid -> Cr_g_tab)
  147. #define Cb_g_tab (mvid -> Cb_g_tab)
  148. #define Cb_b_tab (mvid -> Cb_b_tab)
  149.  
  150.     /* We define tables that convert a color value between -256 and 512
  151.      * into the R, G and B parts of the pixel. The normal range is 0-255.
  152.      */
  153.  
  154.     long                    *r_2_pix;
  155.     long                    *g_2_pix;
  156.     long                    *b_2_pix;
  157.     long                    *r_2_pix_alloc;
  158.     long                    *g_2_pix_alloc;
  159.     long                    *b_2_pix_alloc;
  160.  
  161. #define r_2_pix         (mvid -> r_2_pix)
  162. #define g_2_pix         (mvid -> g_2_pix)
  163. #define b_2_pix         (mvid -> b_2_pix)
  164. #define r_2_pix_alloc   (mvid -> r_2_pix_alloc)
  165. #define g_2_pix_alloc   (mvid -> g_2_pix_alloc)
  166. #define b_2_pix_alloc   (mvid -> b_2_pix_alloc)
  167.  
  168.     /* used by video.c/mpegVidRsrc (first set to TRUE !!) */
  169.     BOOL                     mvid_mpegVidRsrc_first;
  170.     BOOL                     mvid_UseVMM; /* use vmm.library memory for frame bitmaps */
  171.  
  172.     /* used by mpegvideo.c/ReconPMBlock */
  173.     int                      ReconPMBlock_right_for,
  174.                              ReconPMBlock_down_for,
  175.                              ReconPMBlock_right_half_for,
  176.                              ReconPMBlock_down_half_for;
  177.  
  178.     /* used in mpegvideo.c (static) */
  179.     BOOL                     No_P_Flag;
  180.     BOOL                     No_B_Flag;
  181.  
  182.     /* set in mpeggdith.c */
  183.     /* Range values for lum, cr, cb. */
  184.     ULONG                    LUM_RANGE;
  185.     ULONG                    CR_RANGE;
  186.     ULONG                    CB_RANGE;
  187. #define LUM_RANGE (mvid -> LUM_RANGE)
  188. #define CR_RANGE  (mvid -> CR_RANGE)
  189. #define CB_RANGE  (mvid -> CB_RANGE)
  190.  
  191.     /* used by mpeggdith.c && mpeggray.c && mpegordered.c */
  192.     LONG *mappixel; /* Array that remaps color numbers to actual pixel values */
  193. #define mappixel      (mvid -> mappixel)
  194.  
  195.     /* Arrays holding quantized value ranged for lum, cr, and cb. */
  196.     UBYTE                   *lum_values;
  197.     UBYTE                   *cr_values;
  198.     UBYTE                   *cb_values;
  199. #define lum_values (mvid -> lum_values)
  200. #define cr_values  (mvid -> cr_values)
  201. #define cb_values  (mvid -> cb_values)
  202.  
  203.     /* globals */
  204.     ULONG                     ditherType;        /* Declaration of global variable to hold dither info. */
  205. #define ditherType    (mvid -> ditherType)
  206.     ULONG                     pixfmt;            /* CyberGFX pixel format */
  207. #define pixfmt        (mvid -> pixfmt)
  208.  
  209.     /* from mpeggdith.c (static) */
  210.     BYTE                    *imagedata;
  211.  
  212.     /* used by mpegmain.c (static) */
  213.     BPTR                     input;      /* Global file pointer to incoming data. */
  214.     BOOL                     EOF_flag;   /* End of File flag. */
  215.     ULONG                    xtpf;       /* streams TicksPerFrame */
  216.     jmp_buf                  exit_buf;
  217. #define EOF_flag      (mvid -> EOF_flag)
  218. #define xtpf          (mvid -> xtpf)
  219. #define exit_buf      (mvid -> exit_buf)
  220.  
  221.     VidStream               *curVidStream; /* Declaration of global pointer to current video stream. */
  222. #define curVidStream  (mvid -> curVidStream)
  223.  
  224.     /* used in mpegvideo.c (static) */
  225.     /* Max lum, chrom indices for illegal block checking. */
  226.     int                      lmaxx;
  227.     int                      lmaxy;
  228.     int                      cmaxx;
  229.     int                      cmaxy;
  230. #define lmaxx         (mvid -> lmaxx)
  231. #define lmaxy         (mvid -> lmaxy)
  232. #define cmaxx         (mvid -> cmaxx)
  233. #define cmaxy         (mvid -> cmaxy)
  234.  
  235.     /* used in mpegvideo.c && mpeggdith.c */
  236.     ULONG                    totNumFrames;
  237. #define totNumFrames  (mvid -> totNumFrames)
  238.  
  239.     /* video.c (static) */
  240.     APTR                     mvid_MPPool;
  241.     struct ColorRegister     used_colors[ 512 ];
  242.     ULONG                    used_cnt;
  243.     UWORD                    anim_width,
  244.                              anim_height,
  245.                              anim_depth,
  246.                              video_width,
  247.                              video_height;
  248.     BOOL                     mvid_UseChunkyMap;
  249. #define mpegrp                (mvid -> mpegrp)
  250. #define temprp                (mvid -> temprp)
  251. #define used_colors           (mvid -> used_colors)
  252. #define used_cnt              (mvid -> used_cnt)
  253. #define anim_width            (mvid -> anim_width)
  254. #define anim_height           (mvid -> anim_height)
  255. #define anim_depth            (mvid -> anim_depth)
  256. #define video_width           (mvid -> video_width)
  257. #define video_height          (mvid -> video_height)
  258.     struct ProgressRequester mvid_PR;
  259.  
  260.     STRPTR                   mvid_ProjectName; /* From DTA_Name */
  261. };
  262.  
  263. #endif /* !MPEGAMIGA_H */
  264.  
  265.  
  266.  
  267.